package com.ycfmedical.bed.local.dao;

import android.content.Context;

import com.ycfmedical.bed.greendao.gen.DaoSession;
import com.ycfmedical.bed.local.entity.PhysicianChargeMsg;
import com.ycfmedical.bed.utils.AssetsHelper;
import com.ycfmedical.bed.utils.GsonHelper;

import java.util.List;

/**
 * Created by yf on 2017-03-28.
 */

public class PhysicianChargeDAO {
    private PhysicianChargeDAO() {
    }

    private static List<PhysicianChargeMsg> sPhysicianChargeMsgList;

    public static void updatePhysicianChargeData(Context context, DaoSession daoSession) {
        sPhysicianChargeMsgList = GsonHelper.convertEntities(AssetsHelper.readData(context, "PhysicianChargeTab"), PhysicianChargeMsg.class);
        com.ycfmedical.bed.greendao.gen.PhysicianChargeMsgDao beanDao = daoSession.getPhysicianChargeMsgDao();
        if (beanDao.count() == 0) {
            beanDao.insertInTx(sPhysicianChargeMsgList);
        }
    }

    /**
     * 获取所有用户
     *
     * @return
     */
    public static List<PhysicianChargeMsg> getAllStaffInfoList() {
        return sPhysicianChargeMsgList;
    }
}
